package com.zisu.springbootsource.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WeatherRunListener {
    @Autowired
    private WeatherEventMulticaster weatherEventMulticaster;


    //通过 加入@Component注解 这种形式，，就不需要把监听器 注入到 广播 中取了，直接调用snow就行了。
    public void snow(){
        weatherEventMulticaster.multicastEvent(new SnowEvent());
    }

    public void rain(){
        weatherEventMulticaster.multicastEvent(new RainEvent());
    }
}